class R {
  constructor(code, message, data) {
    this.code = code
    this.message = message
    this.data = data
  }

  static success(data = {}) {
    return new R(0, 'success', data)
  }

  static error(obj, data = {}) {
    return new R(obj.code, obj.message, data)
  }
}

module.exports = R
